In general, the IRIX scheduling algorithms will run a process that is ready to run on any CPU. This is modified by considerations of
Note: Restricting a CPU overrides any group assignment made with pset. A restricted CPU remains part of a group, but does not perform any work you assign to the group using pset. You can find out the number of CPUs that exist, and the number that are still unrestricted, using the sysmp() function as in Example 6-9.
Example 6-9 : Number of Processors Available and Total
#include <sys/sysmp.h> int CPUsInSystem = sysmp(MP_NPROCS); int CPUsNotRestricted = sysmp(MP_NAPROCS);To restrict one or more CPUs, you can use mpadmin. For example, to restrict CPUs 4 and 5, you can use
The equivalent operation from within a program uses sysmp() as in Example 6-10 (see also the sysmp(2) reference page).mpadmin -r 4 mpadmin -r 5
Example 6-10 : Restricting a CPU
#include <sys/sysmp.h> int restrictCpuN(int cpu) { int ret = sysmp(MP_RESTRICT,cpu); if (-1 == ret) perror("sysmp(MP_RESTRICT)"); return ret; }You remove the restriction, allowing the CPU to execute any scheduled process, with mpadmin -u or with sysmp(MP_EMPOWER).
Note: The following points are important to remember:
The equivalent operation from within a program uses sysmp() as in Example 6-11 (see also the sysmp(2) reference page).runon 3 ~rt/bin/rtapp
Example 6-11 : Assigning the Calling Process to a CPU
#include <sys/sysmp.h> int runMeOn(int cpu) { int ret = sysmp(MP_MUSTRUN,cpu); if (-1 == ret) perror("sysmp(MP_MUSTRUN)"); return ret; }You remove the assignment, allowing the process to execute on any available CPU, with sysmp(MP_RUNANYWHERE). There is no command equivalent.
The assignment to a specified CPU is inherited by processes created by the assigned process. Thus if you assign a real-time program with runon, all the processes it creates run on that same CPU. More often you will want to run multiple processes concurrently on multiple CPUs. There are three approaches you can take:
The CPUs that service the gang queue cannot be restricted. However, if yours is the only gang-scheduled program, those CPUs will effectively be dedicated to your program.